]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensions-app: Use Adw.Application's automatic style loading
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 5 Jan 2022 13:51:53 +0000 (14:51 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 5 Jan 2022 14:50:43 +0000 (15:50 +0100)
Now that we switched to AdwApplication, we can automate loading
the custom stylesheet by simply using the expected name and
resource prefix.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1997>

subprojects/extensions-app/data/css/application.css [deleted file]
subprojects/extensions-app/data/css/style.css [new file with mode: 0644]
subprojects/extensions-app/data/meson.build
subprojects/extensions-app/data/org.gnome.Extensions.data.gresource.xml [deleted file]
subprojects/extensions-app/data/org.gnome.Extensions.data.gresource.xml.in [new file with mode: 0644]
subprojects/extensions-app/js/main.js

diff --git a/subprojects/extensions-app/data/css/application.css b/subprojects/extensions-app/data/css/application.css
deleted file mode 100644 (file)
index b5e6b91..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-.details-button image {
-  transition: 250ms;
-}
-.details-button.expanded:dir(ltr) image {
-  -gtk-icon-transform: rotate(0.25turn);
-}
-.details-button.expanded:dir(rtl) image {
-  -gtk-icon-transform: rotate(-0.25turn);
-}
-
-image.error { color: @error_color; }
-image.warning { color: @warning_color; }
diff --git a/subprojects/extensions-app/data/css/style.css b/subprojects/extensions-app/data/css/style.css
new file mode 100644 (file)
index 0000000..b5e6b91
--- /dev/null
@@ -0,0 +1,12 @@
+.details-button image {
+  transition: 250ms;
+}
+.details-button.expanded:dir(ltr) image {
+  -gtk-icon-transform: rotate(0.25turn);
+}
+.details-button.expanded:dir(rtl) image {
+  -gtk-icon-transform: rotate(-0.25turn);
+}
+
+image.error { color: @error_color; }
+image.warning { color: @warning_color; }
index 4b601e8bd1a4472c96b4be8cbbd954d49fe7b94b..4f24267b04a634f14a0eb14bd2f6988a8b331a19 100644 (file)
@@ -1,6 +1,10 @@
 gnome.compile_resources(
   app_id + '.data',
-  base_id + '.data.gresource.xml',
+  configure_file(
+    input: base_id + '.data.gresource.xml.in',
+    output: app_id + '.data.gresource.xml',
+    configuration: {'profile': '/'.join(profile.split('.')) },
+  ),
   gresource_bundle: true,
   install: true,
   install_dir: pkgdatadir
diff --git a/subprojects/extensions-app/data/org.gnome.Extensions.data.gresource.xml b/subprojects/extensions-app/data/org.gnome.Extensions.data.gresource.xml
deleted file mode 100644 (file)
index 659c03f..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gresources>
-  <gresource prefix="/org/gnome/Extensions">
-    <file>css/application.css</file>
-
-    <file>dbus-interfaces/org.gnome.Shell.Extensions.xml</file>
-
-    <file>ui/extension-row.ui</file>
-    <file>ui/extensions-window.ui</file>
-  </gresource>
-</gresources>
diff --git a/subprojects/extensions-app/data/org.gnome.Extensions.data.gresource.xml.in b/subprojects/extensions-app/data/org.gnome.Extensions.data.gresource.xml.in
new file mode 100644 (file)
index 0000000..ca04c08
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/Extensions@profile@">
+    <file alias="style.css">css/style.css</file>
+  </gresource>
+
+  <gresource prefix="/org/gnome/Extensions">
+    <file>dbus-interfaces/org.gnome.Shell.Extensions.xml</file>
+
+    <file>ui/extension-row.ui</file>
+    <file>ui/extensions-window.ui</file>
+  </gresource>
+</gresources>
index cbdac693f261914f6aff3e48f56c4949025f0a06..563cd7e456a95e5bbfa82ebb2db98e73e9791069 100644 (file)
@@ -1,10 +1,9 @@
 /* exported main */
-imports.gi.versions.Gdk = '4.0';
 imports.gi.versions.Gtk = '4.0';
 
 const Gettext = imports.gettext;
 const Package = imports.package;
-const { Adw, Gdk, GLib, Gio, GObject, Gtk, Shew } = imports.gi;
+const { Adw, GLib, Gio, GObject, Gtk, Shew } = imports.gi;
 
 Package.initFormat();
 
@@ -58,17 +57,6 @@ class Application extends Adw.Application {
     vfunc_startup() {
         super.vfunc_startup();
 
-        let provider = new Gtk.CssProvider();
-        let uri = 'resource:///org/gnome/Extensions/css/application.css';
-        try {
-            provider.load_from_file(Gio.File.new_for_uri(uri));
-        } catch (e) {
-            logError(e, 'Failed to add application style');
-        }
-        Gtk.StyleContext.add_provider_for_display(Gdk.Display.get_default(),
-            provider,
-            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
         const action = new Gio.SimpleAction({ name: 'quit' });
         action.connect('activate', () => this._window.close());
         this.add_action(action);